<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/cropbox/cropbox.css}" rel="stylesheet"/>
 <script th:src="@{/ajax/libs/layui/layui.js}"
		        charset="utf-8"></script>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content"><!-- method="post"   enctype="multipart/form-data"-->
		<form class="form-horizontal m" id="form-ggTable-add" >
			<div class="form-group">
				<label class="col-sm-3 control-label">广告名称：</label>
				<div class="col-sm-8">
					<input id="gName" name="gName" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">广告图片：</label>
				<div class="col-sm-8">
					<input id="gImgs" name="gImgs" class="" type="hidden" required lay-verify="required"  />
					<button type="button" class="layui-btn layui-btn-primary" id="fileBtn"><i class="layui-icon">&#xe67c;</i>选择文件</button>
					<button type="button" class="layui-btn layui-btn-warm" id="uploadBtn">开始上传</button>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		/** 上传图片 */
                   layui.use('upload',function(){
                       var upload = layui.upload;
                         upload.render({
                                elem: '#fileBtn'
                             ,url: '/integral/ggTable/add'
                             ,accept: 'file'
                             ,auto: false
                             ,bindAction: '#uploadBtn'
                             ,done: function(res){
                                     alert(res.data.src);
                                     $("[name=gImgs]").val(res.data.src);
                                 }
                         });
                    });

		/*var prefix = ctx + "integral/ggTable"
		$("#form-ggTable-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});

		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-ggTable-add').serialize());
	        }
	    }*/

	</script>
</body>
</html>
